/
 * 商品标签
 */
<template>
  <div class="Goods">
    <div class="main" style="border-radius: 5px">
      <!--列表-->
      <div class="banManage">
        <div class="evalLeft">
          <div class='dengji'>
            <el-select v-model="value1" placeholder="评价等级" >
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
          </div>
          <div class="blocks" style="width: 260px; margin-left: 3%">
            <el-date-picker
              v-model="time1"
              type="daterange"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              style="width: 260px"
              id="startime"
            >
            </el-date-picker>
          </div>
        </div>
        <p :class="multipleSelection && multipleSelection.length > 0? 'batchDel': 'ulborder'"
            @click="dellist()">批量删除
        </p>
      </div>
      <div class="evalContent">
        <div class="evalucation">
          <el-table
            :data="evalRes"
            @selection-change="handleSelectionChange"
            size="small"
            v-loading="loading"
            element-loading-text="拼命加载中"
            style="width: 100%"
            :header-cell-style="{
              color: '#3D3D3D',
              'font-size': '22px',
              height: '60px',
              'font-weight': '400',
              'background-color': '#F8F9FB',
              'border-bottom': 'none',
            }"
            class="customer-table"
            :row-class-name="tableRowClassName"
          >
            <el-table-column type="selection" width="100" align="center">
            </el-table-column>
            <el-table-column
              prop="id"
              label="ID"
              width="50"
              align="left"
            ></el-table-column>
            <el-table-column
              prop="user"
              label="用户"
              main-width="16%"
              align="center"
            ></el-table-column>
            <el-table-column label="商品名称" width="210" align="center">
              <template slot-scope="scope">
                <div class="nameBox">
                  <!-- <img :src="scope.row.image" style="width:50px;height:50px;"/> -->
                  <img
                    src="../../assets/img/a.jpg"
                    style="width: 50px; height: 50px"
                  />
                  <span>{{ scope.row.shopName }}</span>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              prop="evaluation"
              label="评价"
              width="180"
              align="center"
            >
              <template slot-scope="scope">
                <el-rate v-model="scope.row.value2"></el-rate>
              </template>
            </el-table-column>
            <el-table-column
              prop="evaContent"
              label="评价内容"
              main-width="16%"
              align="center"
            ></el-table-column>
            <el-table-column
              prop="evaReply"
              label="评价回复"
              main-width="16%"
              align="center"
            ></el-table-column>
            <el-table-column
              label="启用"
              main-width="16%"
              align="center"
              property="value"
            >
              <template slot-scope="scope">
                <el-switch
                  v-model="scope.row.is_show"
                  active-color="#13ce66"
                  :active-value="1"
                  :inactive-value="0"
                  inactive-color="#C1C1C1"
                ></el-switch>
              </template>
            </el-table-column>
            <el-table-column
              prop="address"
              label="操作"
              width="140%"
              align="center"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <el-button
                  type="text"
                  style="font-size: 0.875rem; color: #436af2"
                  @click="replition(scope.$index, scope.row)"
                  >回复</el-button
                >
                <el-button
                  type="text"
                  style="font-size: 0.875rem; color: #436af2"
                  @click="deleteUser(scope.$index, scope.row)"
                  >删除</el-button
                >
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>
    </div>
    <!-- 回复评论 -->
    <el-dialog :visible.sync="replies" width="380px" style="margin-top: 120px">
      <span class="nav">回复评价</span>
      <div class="navBox">
        <el-input
          type="textarea"
          :rows="6"
          placeholder="请输入内容"
          v-model="textarea"
        ></el-input>
      </div>
      <span slot="footer" class="shopFooter">
        <el-button
          @click="submitForms()"
          style="
            width: 50%;
            padding: 0.75rem 0;
            background-color: #436af2;
            color: #fff;
            font-size: 0.875rem;
            border-radius: 5px;
          "
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <!-- 分页 -->
    <div class="paging">
      <div class="pagiton">
        <button class="btn btn-default" type="submit" @click="prePage">
          <i class="el-icon-caret-left"></i>
        </button>
        <button class="btn btn-defaults" type="submit">
          {{ current_page }}
        </button>
        <button
          class="btn btn-default"
          type="submit"
          @click="nextPage"
          :class="{ disabled: disableds }"
        >
          <i class="el-icon-caret-right"></i>
        </button>
        <p class="remarks">
          共 <span> {{ pagesize }} </span>条当前为第
          <span> {{ currentPage }} </span>页
        </p>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      currentPage: 1, //当前页号
      pagesize: 20, //每页大小
      disableds: false,
      options: [
        {
          value: "1",
          label: "评价等级",
        },
      ],
      valu2: "",
      time1: "",
      value1: "1",
      loading: false,
      evalRes: [
        {
          id: "01",
          user: "星空",
          shopName: "黑金肌底液",
          evaContent: "棒棒哒",
          evaReply: "感谢亲的评价！",
          value2: 3.4,
        },
        {
          id: "02",
          user: "星空",
          shopName: "黑金肌底液",
          evaContent: "棒棒哒",
          evaReply: "感谢亲的评价！",
          value2: 3.6,
        },
        {
          id: "03",
          user: "星空",
          shopName: "黑金肌底液",
          evaContent: "棒棒哒",
          evaReply: "感谢亲的评价！",
          value2: 4.1,
        },
        {
          id: "04",
          user: "星空",
          shopName: "黑金肌底液",
          evaContent: "棒棒哒",
          evaReply: "感谢亲的评价！",
          value2: 4.5,
        },
      ],
      replies: false,
      textarea: "",
      multipleSelection: "", // 所选择的主数据
    };
  },
  created() {},
  computed: {
    page_arrs() {
      let { currentPage, pagesize } = this;
      return this.evalRes.slice(
        (currentPage - 1) * pagesize,
        currentPage * pagesize
      );
    },
    current_page() {
      return this.currentPage;
    },
  },
  methods: {
    replition() {
      this.replies = true;
    },
    submitForms(index, row) {
      this.replies = false;
    },
    //隔行换色
    tableRowClassName({ row, rowIndex }) {
      if (rowIndex % 2 === 1) {
        return "warning-row";
      } else {
        return "success-row";
      }
    },
    //删除
    deleteUser(index, row) {
      this.$confirm("确定要删除吗?", "信息", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {})
        .catch((err) => {
          this.loading = false;
          this.$message({
            type: "error",
            message: "删除失败",
          });
        });
    },
    // 序号选择操作
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    // 批量删除
    dellist(){

    },
    //分页
    prePage() {
      this.disableds = false;
      if (this.currentPage == 1) {
        return;
      }
      this.currentPage = this.currentPage - 1;
      // this.List()
    },
    nextPage() {
      if (this.currentPage == Math.ceil(this.evalRes.length)) {
        return;
      }
      this.currentPage = this.currentPage + 1;
      // this.List()
    },
  },
};
</script>
<style scoped>
.evalucation .el-button:hover{
  font-weight: bold;
}
/* 分页 */
.pagiton {
  text-align: center;
  padding-bottom: 10px;
  padding-top:45px;
  display: flex;
  width: 280px;
  align-items: center;
  margin: 0 auto;
}
.pagiton .btn-defaults {
  background-color: #436af2;
  border-radius: 5px;
  font-size: 0.875rem;
  color: #fff;
  border: 1px solid #436af2;
  height: 28px;
  width: 28px;
  line-height: 28px;
  margin: 0 10px;
}
.pagiton .btn-default {
  background-color: #fff;
  border: 1px solid #f7f7f7;
  color: #c1c1c1;
  height: 28px;
  width: 32px;
  line-height: 28px;
  font-size: 0.875rem;
}
.pagiton .remarks {
  margin: 10px 0;
  color: #ababab;
  font-size: 0.875rem;
  padding-left: 5px;
}
/* input框 */
/deep/ .el-table--small .el-table__cell {
  padding: 5px 0;
} /* 列表行高 */
/deep/ .el-input__inner {
  border-radius: 0;
  font-size: 0.875rem;
  border: 1px solid #e7e6e6;
  color: #333333 !important;
}
/deep/ .el-select .el-input.is-focus .el-input__inner {
  border: 1px solid #e7e6e6;
}
/deep/ .el-select .el-input__inner:focus {
  border: 1px solid #e7e6e6;
}
/deep/ .el-range-editor.is-active,
.el-range-editor.is-active:hover {
  border: 1px solid #e7e6e6;
}
/deep/ input::placeholder {
  color: #333333 !important;
}
/deep/.el-date-editor .el-range-input {
  color: #333333;
  font-size: 0.87rem;
}
/deep/ .el-popper {
  margin-top: 125px !important;
}
.Goods{
  background-color: #fff;
}
.main {
  padding: 0 30px;
  box-sizing: border-box;
  overflow: hidden;
}
.banManage {
  background-color: #fff;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
}
.evalLeft {
  display: flex;
  align-items: center;
}
.dengji{
  width: 25%;
}
.batchDel {
  color: #ffffff;
  cursor: pointer;
  font-size: 14px;
  width: 100px;
  height: 38px;
  text-align: center;
  line-height: 38px;
  background-color: #436af2;
  border: 1px solid #436af2;
  border-radius: 5px;
}
.ulborder{
  border-radius: 5px;
  border: 1px solid #E3E2E5;
  cursor: pointer;
  font-size: 14px;
  width: 100px;
  height: 38px;
  text-align: center;
  line-height: 38px;
}
.evalContent {
  margin-top: 1.5rem;
}

/* .evalucation{margin-bottom: 0.875rem;} */
.nameBox {
  display: flex;
}
.nameBox span {
  margin-top: 14px;
  margin-left: 15px;
  font-size: 0.875rem;
  color: #333333;
}
/* 弹框 */
.nav {
  font-size: 1.125rem;
  color: #3d3d3d;
  font-weight: bold;
  line-height: 60px;
}
/deep/ .el-dialog {
  border-radius: 8px;
}
.shopFooter {
  text-align: center;
  display: inline-block;
  width: 70%;
  margin-top: 1.5rem;
  margin-right: 15%;
}
.navBox {
  margin-top: 0.875rem;
  margin-bottom: 0.875rem;
}
/deep/.el-table .warning-row {
  background: #f8f9fb !important;
}

/deep/.el-table .success-row {
  background: white !important;
}
/deep/ .el-table td.el-table__cell,
.el-table th.el-table__cell.is-leaf {
  border-bottom: none;
}
/deep/ .el-table td.el-table__cell div {
  font-size: 0.875rem;
}
/deep/ .el-table th.el-table__cell > .cell {
  font-size: 15px;
}
</style>